<?php

namespace api\modules\app\models;

use Yii;

/**
 * This is the model class for table "unit_event".
 *
 * @property string $event_id
 * @property string $unit_code
 * @property integer $user_id
 * @property integer $unit_id
 * @property string $user_name
 * @property integer $state
 * @property string $code
 * @property string $event_type
 * @property string $name
 * @property string $desc
 * @property integer $event_time
 * @property integer $create_time
 */
class UnitEvent extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'unit_event';
    }

    /**
     * @return \yii\db\Connection the database connection used by this AR class.
     */
    public static function getDb()
    {
        return Yii::$app->get('test_3');
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['event_id', 'unit_code'], 'required'],
            [['user_id', 'state', 'event_time', 'create_time'], 'integer'],
            [['unit_code', 'event_type'], 'string', 'max' => 255],
            [['user_name'], 'string', 'max' => 50],
            [['code', 'name', 'event_id'], 'string', 'max' => 100],
            [['desc'], 'string', 'max' => 1000],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'event_id' => 'Event ID',
            'unit_code' => 'Unit Code',
            'user_id' => 'User ID',
            'unit_id' => 'Unit ID',
            'user_name' => 'User Name',
            'state' => 'State',
            'code' => 'Code',
            'event_type' => 'Event Type',
            'name' => 'Name',
            'desc' => 'Desc',
            'event_time' => 'Event Time',
            'create_time' => 'Create Time',
        ];
    }
}
